package net.mikoo.seals.api.model.schedule;

import java.util.List;

import net.mikoo.seals.api.model.BaseResponse;
import net.mikoo.seals.common.model.PageModel;
import net.mikoo.seals.model.Notice;

public class GetScheduleListResponse extends BaseResponse {

	private static final long serialVersionUID = 6370580125843541159L;

	private List<ScheduleInfo> schedules;

	public List<ScheduleInfo> getSchedules() {
		return schedules;
	}

	public void setSchedules(List<ScheduleInfo> schedules) {
		this.schedules = schedules;
	}
	
	@SuppressWarnings("deprecation")
	public static GetScheduleListResponse valueOf(PageModel<Notice> pm) {
		
		GetScheduleListResponse result = new GetScheduleListResponse();
//		if(pm == null || pm.getDatas() == null || pm.getDatas().isEmpty()) {
//			return result;
//		}
//		List<ScheduleInfo> schedules = new ArrayList<ScheduleInfo>();
//		for(Notice schedule : pm.getDatas()) {
//			if(schedule == null) {
//				continue;
//			}
//			
//			ScheduleInfo scheduleInfo = new ScheduleInfo();
//			
//			scheduleInfo.setVerifyId(schedule.getObjectId());
//			scheduleInfo.setScheduleId(schedule.getScheduleId());
//			scheduleInfo.setName(schedule.getScheduleName());
//			scheduleInfo.setDescription(schedule.getDescription());
//			
//			if(schedule.getCreateTime().getDate() == new Date().getDate()) {
//				scheduleInfo.setTime(new SimpleDateFormat("HH:mm").format(schedule.getCreateTime()));
//			}else {
//				scheduleInfo.setTime(new SimpleDateFormat("yyyy/M/d").format(schedule.getCreateTime()));
//			}
//			scheduleInfo.setType(schedule.getScheduleType());
//			NoticeStatusEnum status = NoticeStatusEnum.getByCode(schedule.getScheduleStatus());
//			if(status != null) {
//				scheduleInfo.setStatusName(status.getMessage());
//			}
//			
//			schedules.add(scheduleInfo);
//		}
//		result.setSchedules(schedules);
		return result;
	}
}
